﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta charset="utf-8">
    <!-- Title and other stuffs -->
    <title>添加音乐</title>
    <!-- Stylesheets -->
    <link href="style/bootstrap.css" rel="stylesheet">
    <!-- Font awesome icon -->
    <link rel="stylesheet" href="style/font-awesome.css">
    <!-- jQuery UI -->
    <link rel="stylesheet" href="style/jquery-ui.css">
    <!-- Calendar -->
    <link rel="stylesheet" href="style/fullcalendar.css">
    <!-- prettyPhoto -->
    <link rel="stylesheet" href="style/prettyPhoto.css">
    <!-- Star rating -->
    <link rel="stylesheet" href="style/rateit.css">
    <!-- Date picker -->
    <link rel="stylesheet" href="style/bootstrap-datetimepicker.min.css">
    <!-- CLEditor -->
    <link rel="stylesheet" href="style/jquery.cleditor.css">
    <!-- Bootstrap toggle -->
    <link rel="stylesheet" href="style/bootstrap-switch.css">
    <!-- Main stylesheet -->
    <link href="style/style.css" rel="stylesheet">
    <!-- Widgets stylesheet -->
    <link href="style/widgets.css" rel="stylesheet">

    <!-- HTML5 Support for IE -->
    <!--[if lt IE 9]>
  <script src="js/html5shim.js"></script>
  <![endif]-->

</head>

<body>

    <!-- Header starts -->
    <header>
        <div class="container">
            <div class="row">

                <!-- Logo section -->
                <div class="col-md-4">
                    <!-- Logo. -->
                    <div class="logo">
                        <h1><a href="#">后台管理系统<span class="bold"></span></a></h1>
                    </div>
                    <!-- Logo ends -->
                </div>

            </div>
        </div>
    </header>

    <!-- Header ends -->

    <!-- Main content starts -->

    <div class="content">

        <!-- Sidebar -->
        <div class="sidebar">
            <ul id="nav">
                <li><a href="music_list.html"><i class="icon-table"></i>音乐列表</a></li>
                <li><a href="music_edit.html" class="open"><i class="icon-tasks"></i>音乐添加</a></li>
            </ul>
        </div>

        <!-- Sidebar ends -->

        <!-- Main bar -->
        <div class="mainbar">

            <!-- Matter -->

            <div class="matter">
                <div class="container">

                    <div class="row">

                        <div class="col-md-12">


                            <div class="widget wgreen">

                                <div class="widget-head">
                                    <div class="pull-left">音乐</div>
                                    <div class="widget-icons pull-right">
                                        <a href="#" class="wminimize"><i class="icon-chevron-up"></i></a>
                                        <a href="#" class="wclose"><i class="icon-remove"></i></a>
                                    </div>
                                    <div class="clearfix"></div>
                                </div>

                                <div class="widget-content">
                                    <div class="padd">

                                        <!-- Form starts.  -->
                                        <form class="form-horizontal" role="form">

                                            <div class="form-group">
                                                <label class="col-lg-4 control-label">音乐名称</label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" placeholder="音乐名称" id="txt_MusicName">
                                                </div>
                                            </div>
                                            <hr />

                                            <div class="form-group">
                                                <label class="col-lg-4 control-label">音乐地址</label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" placeholder="音乐地址" id="txt_MusicUrl">
                                                </div>
                                            </div>
                                            <hr />
                                            <div class="form-group">
                                                <label class="col-lg-4 control-label">是否使用</label>
                                                <div class="col-lg-8">
                                                    <label class="checkbox-inline">
                                                        <input type="checkbox" id="cbIsUse" value="1" checked>
                                                      </label>
                                                </div>
                                            </div>
                                            <hr />

                                            <div class="form-group">
                                                <label class="col-lg-4 control-label">排序</label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" placeholder="排序" id="txt_Sort">
                                                </div>
                                            </div>
                                            <hr />

                                            <div class="form-group">
                                                <label class="col-lg-4 control-label">封面地址</label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" placeholder="封面地址" id="txt_CoverImage">
                                                </div>
                                            </div>
                                            <hr />


                                            <div class="form-group">
                                                <div class="col-lg-offset-1 col-lg-9">
                                                    <button type="button" class="btn btn-primary" id="btn_Save" onclick="addMusic();">保存</button>
                                                </div>
                                            </div>
                                        </form>


                                    </div>
                                </div>

                            </div>

                        </div>

                    </div>

                </div>
            </div>

            <!-- Matter ends -->

        </div>

        <!-- Mainbar ends -->
        <div class="clearfix"></div>

    </div>
    <!-- Content ends -->

    <!-- Footer starts -->
    <footer>
        <div class="container">
            <div class="row">
                <div class="col-md-12">
                    <!-- Copyright info -->
                    <p class="copy">Copyright &copy; 2015 | <a href="#">安静</a> </p>
                </div>
            </div>
        </div>
    </footer>

    <!-- Footer ends -->

    <!-- Scroll to top -->
    <span class="totop"><a href="#"><i class="icon-chevron-up"></i></a></span>

    <!-- JS -->
    <script src="js/jquery-1.8.3.min.js" type="text/javascript"></script>

    <script src="js/handlebars-v3.0.0.js" type="text/javascript"></script>

    <!-- jQuery -->
    <script src="js/bootstrap.js"></script>
    <!-- Bootstrap -->
    <script src="js/jquery-ui-1.9.2.custom.min.js"></script>
    <!-- jQuery UI -->
    <script src="js/fullcalendar.min.js"></script>
    <!-- Full Google Calendar - Calendar -->
    <script src="js/jquery.rateit.min.js"></script>
    <!-- RateIt - Star rating -->
    <script src="js/jquery.prettyPhoto.js"></script>
    <!-- prettyPhoto -->

    <!-- jQuery Flot -->
    <script src="js/excanvas.min.js"></script>
    <script src="js/jquery.flot.js"></script>
    <script src="js/jquery.flot.resize.js"></script>
    <script src="js/jquery.flot.pie.js"></script>
    <script src="js/jquery.flot.stack.js"></script>

    <!-- jQuery Notification - Noty -->
    <script src="js/jquery.noty.js"></script>
    <!-- jQuery Notify -->
    <script src="js/themes/default.js"></script>
    <!-- jQuery Notify -->
    <script src="js/layouts/bottom.js"></script>
    <!-- jQuery Notify -->
    <script src="js/layouts/topRight.js"></script>
    <!-- jQuery Notify -->
    <script src="js/layouts/top.js"></script>
    <!-- jQuery Notify -->
    <!-- jQuery Notification ends -->

    <script type="text/javascript">
        function addMusic() {
            var name = $("#txt_MusicName").val();
            var url = $("#txt_MusicUrl").val();
            var sort = $("#txt_Sort").val();
            var img = $("#txt_CoverImage").val();
            var isuse;
            if($("#cbIsUse").attr('checked')){
                isuse=1;
            }
            if (name == "" || url == "") {
                alert("请填写音乐名称和音乐地址");
                return;
            }

            $.ajax({
                url: "/api/addMusic.php",
                data: { MusicName: name, MusicUrl: url, IsUse: 1, Sort: sort, CoverImage: img },
                type: "get",
                //                                                    contentType:"application/json",
                //                                                    dataType:"json",
                success: function (result) {
                    alert(result)
                }
            });
        }
    </script>
</body>
</html>